package com.tianping.serializable;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class TestSerializable{
	
	public static void main(String[] args) throws IOException, ClassNotFoundException{
		 FileOutputStream fos = new FileOutputStream("temp.out");  
		 
         ObjectOutputStream oos = new ObjectOutputStream(fos);  

         Target st = new Target();  
         
         st.map.put("test", "ttt");
         
         st.map.put("test22", 2);

         oos.writeObject(st);  

         oos.flush();  

         oos.close(); 
         
         ObjectInputStream ois = new ObjectInputStream(new FileInputStream("temp.out"));
         
         Target t = (Target)ois.readObject();
         
         System.out.println(t.map.get("test").getClass());
	}
}


class Target implements Serializable{
	
	public int i = 0;
	
	public Map map = new HashMap();
	
}